package route

import (
	"github.com/gin-gonic/gin"
	"github.com/vueadmin/app/admin/internal/handler/base"
	"github.com/vueadmin/app/admin/internal/handler/file"
	"github.com/vueadmin/app/admin/internal/handler/index"
	"github.com/vueadmin/app/admin/internal/middle"
	"github.com/vueadmin/app/admin/internal/svc"
	"github.com/vueadmin/middleware"
	"github.com/vueadmin/utils/conv"
)

type Base struct{}

func (p Base) RegisterRoute(route *gin.Engine, svcCtx *svc.ServiceContext) {
	r := route.Group(svcCtx.Config.Prefix)
	r.Use(middleware.JwtVerifyMiddleware(conv.String(svcCtx.Config.Jwt)), middle.NewBeforActionMiddleware(svcCtx).Handle())
	{
		r.POST("/Base/getSiteInfo", func(c *gin.Context) { base.GetSiteInfo(c, svcCtx) })
		r.POST("/Index/main", func(c *gin.Context) { index.Main(c, svcCtx) })
		r.POST("/Base/resetPwd", func(c *gin.Context) { base.ResetPwd(c, svcCtx) })
		r.POST("/Base/clearCache", func(c *gin.Context) { base.ClearCache(c, svcCtx) })
		r.POST("/Base/getShenshiqu", func(c *gin.Context) { base.GetShenshiqu(c, svcCtx) })
		r.POST("/Base/fileList", func(c *gin.Context) { file.GetPageList(c, svcCtx) })
		r.POST("/Base/deleteFile", func(c *gin.Context) { file.Delete(c, svcCtx) })
		r.POST("/upload/createFile", func(c *gin.Context) { file.Add(c, svcCtx) })
		r.POST("/Upload/upload", func(c *gin.Context) { base.Upload(c, svcCtx) })
		r.POST("/Base/getRoleMenus", func(c *gin.Context) { base.GetRoleMenus(c, svcCtx) })
	}
}
